// SimNet is a Second Life(tm) sim mangement tool that was designed for Fermi Sandbox
// Copyright (C) 2011 Arthur Fermi
// 
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// To receive a copy of this license please visit http://www.gnu.org/licenses/

// SimNet - Parcel Info

// Global Variables
integer gintOnOff;      // 0 = Off 1 = On

 
funGetInfo()
{
    string strPrims = (string)llGetParcelDetails(llGetPos(),[PARCEL_DETAILS_NAME]) +
    "\nMax: " + (string)llGetParcelMaxPrims(llGetPos(), FALSE) + 
    " ~ Used: " + (string)llGetParcelPrimCount(llGetPos(), 0, 0) + 
    " ~ Left: " + (string)(llGetParcelMaxPrims(llGetPos(), FALSE) - llGetParcelPrimCount(llGetPos(), 0, 0));
    llSetText(strPrims, <1,1,1>,1);    
}

funStatus()
{
    if (gintOnOff == 0)
    {
        gintOnOff = 1;
        llSetText("", <1,1,1>, 1);
        funGetInfo();
        llSetTimerEvent(5);
    }
    else if (gintOnOff == 1)
    {
        gintOnOff = 0;
        llSetText("", <1,1,1>, 1);
        llSetTimerEvent(0);
    }
}


default
{
    state_entry()
    {
        gintOnOff = 0;
        funStatus();
    }

    timer()
    {
        funGetInfo(); 
    } 
    on_rez(integer start_param)
    {
        llResetScript();    
    }
}